﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ZLDC.Common.Estate;
using System.Data;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace ZLDC.Topo.BLL.Estate
{
    public class lp_Collection
    {
        public static void BtnAddcollection(string txtCollection, Page p, string mainid, string number)
        {
            string sql = "";
            if (mainid == "")
            {
                sql = "insert into lp_Collection(UserName,UserID,DeptID,DeptType,Message,CreateTime) values('" + _Utility.GetInfoBySession().m_sUserName + "'," +
                   "" + _Utility.GetInfoBySession().m_sUserID + "," + _Utility.GetInfoBySession().m_sDeptID + ",'" + _Utility.GetInfoBySession().m_sDeptName + "','" + txtCollection + "','" + DateTime.Now + "')";
                int i = ZLDC.Topo.BLL.Estate.lp_Basis.Execution_sql(sql);
            }
            else
            {
                sql = " update lp_Collection set number=number+1,see=see+1 where id=" + mainid + "; ";
                sql += "insert into lp_Collection(UserName,UserID,DeptID,DeptType,Message,CreateTime,mainid) values('" + _Utility.GetInfoBySession().m_sUserName + "'," +
                  "" + _Utility.GetInfoBySession().m_sUserID + "," + _Utility.GetInfoBySession().m_sDeptID + ",'" + _Utility.GetInfoBySession().m_sDeptName + "','" + txtCollection + "','" + DateTime.Now + "'," + mainid + ")";
                int i = ZLDC.Topo.BLL.Estate.lp_Basis.Execution_sql(sql);
            }
            p.Response.Write("<script>alert('感谢您的宝贵意见!');window.location.href=location.href;</script>");
        }
        public static void BtnAddcollection(string txtCollection, Page p, string mainid, int rowIndex)
        {
            string sql = "";
            if (mainid == "")
            {
                sql = "insert into lp_Collection(UserName,UserID,DeptID,DeptType,Message,CreateTime) values('" + _Utility.GetInfoBySession().m_sUserName + "'," +
                   "" + _Utility.GetInfoBySession().m_sUserID + "," + _Utility.GetInfoBySession().m_sDeptID + ",'" + _Utility.GetInfoBySession().m_sDeptName + "','" + txtCollection + "','" + DateTime.Now + "')";
                int i = ZLDC.Topo.BLL.Estate.lp_Basis.Execution_sql(sql);
            }
            else
            {
                sql = " update lp_Collection set number=number+1,see=see+1 where id=" + mainid + "; ";
                sql += "insert into lp_Collection(UserName,UserID,DeptID,DeptType,Message,CreateTime,mainid) values('" + _Utility.GetInfoBySession().m_sUserName + "'," +
                  "" + _Utility.GetInfoBySession().m_sUserID + "," + _Utility.GetInfoBySession().m_sDeptID + ",'" + _Utility.GetInfoBySession().m_sDeptName + "','" + txtCollection + "','" + DateTime.Now + "'," + mainid + ")";
                int i = ZLDC.Topo.BLL.Estate.lp_Basis.Execution_sql(sql);
            }
            p.Response.Write("<script>alert('感谢回复!');parent.parentjz(" + rowIndex + "," + mainid + ");parent.ClosePop();</script>");
        }
    }
}
